package io.gitee.yeningx.example.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.gitee.yeningx.tools.web.WebConst;
import io.gitee.yeningx.tools.web.ext.ControllerAdvice4OtherRequestDocs;
import io.gitee.yeningx.tools.web.ext.RequestDoc;
import io.gitee.yeningx.tools.web.ext.RequestDocs;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 针对于当前页面调用公共接口的情况，可以使用如下接口描述方式，
 * 页面访问地址：http://127.0.0.1:8080/doc.html
 */
@RestController
@RequestMapping("/other")
@Tag(name = "调用公共接口")
@ApiSort(10)
public class OtherDocController implements ControllerAdvice4OtherRequestDocs {


    @Override
    public List<RequestDocs> docs4OtherRequest() {
        return List.of(
                new RequestDocs().group("常量").docs(List.of(
                        new RequestDoc().constDescription("是否删除").constDataType("String").constContent("y:删除，n:再用")
                )),

                new RequestDocs().group("公共接口").docs(List.of(
                        new RequestDoc().description("查询省").url("/common/province/list")
                                .params("{'name':'','limit':100}")
                                .paramsDescription("【limit】限制查询的数据量，默认100，【name】可选，名称"),

                        new RequestDoc().description("查询市").method(WebConst.Method.GET).url("/common/city/list")

                ))
        );
    }
}